import { HttpService } from '@/shared/api/httpService';
import type { Post, GetPostsRequest } from './domain';
import {AppBackendService} from "@/shared/api/appBackendService";

class PostsService extends AppBackendService {
    private urls = {
        posts: '/posts',
    };

    getPosts = async (params?: GetPostsRequest): Promise<Post[]> => {
        const result = await this.request<Post[]>(this.urls.posts, { queryParams: params }, { method: 'GET' });

        return result;
    };
}

export const postsService = new PostsService();
// Also export the class for backward compatibility
export { PostsService };
